function adderrorbar,x,y,xer,yer
xl=x-xer
xr=x+xer
yl=y-yer
yu=y+yer
a=plot(x,y)
for i=0,size(x,/n_elements)-1 do begin
  a=plot([xl[i],xr[i]],[y[i],y[i]],/overplot,symbol='vline')
endfor
for i=0,size(y,/n_elements)-1 do begin
  a=plot([x[i],x[i]],[yl[i],yu[i]],/overplot,symbol='hline')
endfor
return, a
end
x=[0.0:4.0:0.2]
y=sin(5*x)
ey=replicate(0.1,size(x,/n_elements))
ex=ey
fig=adderrorbar(x,y,ex,ey)
fig.save, '2.eps'
end